package com.okcoin.websocket.client;

import com.okcoin.common.OKConst;
import com.okcoin.websocket.WebSocketService;

public class StartWebcocket {
    public static void main(String[] args) {

        // 订阅消息处理类,用于处理WebSocket服务返回的消息
        WebSocketService service = new BuissnesWebSocketServiceImpl();

        // WebSocket客户端
        WebSoketClient client = new WebSoketClient(OKConst.WEBSOCKET_ADRESS, service);

        // 启动客户端
        client.start();

        // 添加订阅
       // client.addChannel("ok_sub_spot_eos_usdt_depth_5");

    /*    String[] channelAll ={  OKConst.FUTURE_BTC_QUARTER,//季度btc合约
                                OKConst.FUTURE_EOS_QUARTER,//季度eos合约
                                OKConst.FUTURE_BTC_NEXT_WEEK,//次周BTC合约
                                OKConst.FUTURE_EOS_NEXT_WEEK,//次周EOS合约
                                OKConst.FUTURE_BTC_THIS_WEEK,//本周BTC合约
                                OKConst.FUTURE_EOS_THIS_WEEK,//本周EOS合约
                                OKConst.FUTURE_BTC_INDEX,//btc合约指数
                                OKConst.FUTURE_EOS_INDEX//eos合约指数
        };
        *//*
            订阅合约行情
         *//*
        for (String CA:channelAll) {
            client.addChannel(CA);
        }*/
        //订阅所有指数
        for(String CA:OKConst.FUTUREUSD_INDEX_LIST){
            client.addChannel(CA);
        }

        //订阅所有合约行情
        for(String CA:OKConst.FUTUREUSD_LIST){
            client.addChannel(CA);
        }

        //订阅所有K线
        for(String CA:OKConst.FUTUREEUSD_K_LINE_LIST){
            client.addChannel(CA);
        }

        //季度btc合约
       // client.addChannel("ok_sub_futureusd_btc_ticker_quarter");
        //季度eos合约
       // client.addChannel("ok_sub_futureusd_eos_ticker_quarter");

         //btc合约
        // client.addChannel("ok_sub_futureusd_btc_index");
        //eos合约
        // client.addChannel("ok_sub_futureusd_eos_index");

        // 删除定订阅
        // client.removeChannel("ok_sub_spotusd_btc_ticker");

        // 合约下单交易
        // client.futureTrade(apiKey, secretKey, "btc_usd", "this_week", 2.3, 2,
        // 1, 0, 10);

        // 实时交易数据 apiKey
        // client.futureRealtrades(apiKey, secretKey);

        // 取消合约交易
        // client.cancelFutureOrder(apiKey, secretKey, "btc_usd", 123456L,
        // "this_week");

        // 现货下单交易
        // client.spotTrade(apiKey, secretKey, "btc_usd", 3.2, 2.3, "buy");

        // 现货交易数据
        // client.realTrades(apiKey, secretKey);

        // 现货取消订单
        // client.cancelOrder(apiKey, secretKey, "btc_usd", 123L);

        // 获取用户信息
        // client.getUserInfo(apiKey,secretKey);
    }

}
